import 'package:flutter/material.dart';

class About extends StatefulWidget {
  const About({Key? key}) : super(key: key);

  @override
  State<About> createState() => _AboutState();
}

class NewsList extends StatefulWidget {
  const NewsList({Key? key}) : super(key: key);

  @override
  State<NewsList> createState() => _NewsListState();
}

class _NewsListState extends State<NewsList> {
   List<Widget> _GrenList(){
      List<Widget> list = [];
      for (var i=0;i<100;i++){
          list.add(
              //Text("hello")
              Container(
                margin:EdgeInsets.fromLTRB(0, 10, 0, 0),
                child:Wrap(

                   children:[
                       Flex(direction:Axis.horizontal,
                         mainAxisAlignment:MainAxisAlignment.start,
                         crossAxisAlignment:CrossAxisAlignment.start,
                         children: [
                            Container(
                                width:120,
                                height:60,
                                decoration:ShapeDecoration(
                                  shape:RoundedRectangleBorder(
                                     borderRadius:BorderRadius.circular(4)
                                  ),
                                  image:const DecorationImage(
                                     fit:BoxFit.cover,
                                     image:NetworkImage("https://img0.baidu.com/it/u=1705694933,4002952892&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=281",
                                     ),
                                  )
                                ),
                                clipBehavior:Clip.hardEdge,


                            ),
                            Container(child:Text("baidu.com ${i}"),margin:EdgeInsets.fromLTRB(10,0,0,0),
                            padding:const EdgeInsets.fromLTRB(0, 0, 0, 0),
                            )
                      ],)

                   ],
                )
              )
          );
      }
      return list;
  }

   _NewsListState();

  @override
  Widget build(BuildContext context) {
    var  bottomPadding = MediaQuery.of(context).padding.bottom>0?MediaQuery.of(context).padding.bottom:20.0;
    return Scrollbar(child:
      ListView(
        padding:EdgeInsets.fromLTRB(10, 0, 10, bottomPadding),
        children: [
           Column(
            crossAxisAlignment:CrossAxisAlignment.start,
            children: _GrenList(),
          )
        ],
      )
    );
  }
}


class _AboutState extends State<About> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(

          appBar:AppBar(
            title:Text("About1"),
            shadowColor:Colors.transparent,
            
          ),
          body:Container(
             padding:EdgeInsets.fromLTRB(0, 0, 0, 0),
             child:const NewsList(),
          ),
    );

  }
}

